#include <stdio.h>
#include <string.h>

//https://www.nowcoder.com/practice/5d7dfd405e5f4e4fbfdff6862c46b751?tpId=107&&tqId=33318&rp=1&ru=/ta/beginner-programmers&qru=/ta/beginner-programmers/question-ranking

typedef struct Buy
{
    double money;
    char str[10];
}Buy;

int main() {
    int b = 0;
    Buy a;
    scanf("%lf %5[^\n] %d", &a.money, a.str, &b);
    if (strcmp(a.str, "11 11") == 0) {
        a.money *= 0.7;
    } else if (strcmp(a.str, "12 12") == 0) {
        a.money *= 0.8;
    }
    if (a.money < 0) {
        printf("0.00");
    }else if (b == 0) {
        printf("%.2f", a.money);
    } else if (a.money - 50 < 0) {
        printf("0.00");
    } else if(b == 1) {
        printf("%.2f", a.money - 50);
    }
    return 0;
}